home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-11 | 3.1 KB | 153 lines | [TEXT/PJMM] |
- (**************************************}
- {* displaying information on the screen}
- {* and updating it.}
- {**************************************)
-
- unit InformUser;
- interface
- uses
- {$ifc UNDEFINED THINK_PASCAL}
- Types, QuickDraw, Menus, Windows, TextEdit, Fonts,{}
- Dialogs, Memory, ToolUtils, TextUtils, QuickDrawText, {}
- {$endc}
- SAT, PlatformGlobals, sPlayerSprite;
-
- procedure InitInformationArea;
- procedure DrawProgInfo (me: PlSpritePtr);
- procedure UpdateInfo (me: PlSpritePtr);
- procedure DrawProgrammerInfo;
-
- implementation
-
- {var SpritePtr playerSp:extern; {Skall fixas genom uses!}
-
-
- var
- aActionMsg: array[0..10] of Str255;
- lastActMsg: Integer;
-
- procedure InitInformationArea;
- var
- sh: StringHandle;
- i: Integer;
- r: Rect;
- tmpPort: SATPort;
-
- begin
- lastActMsg := -1;
- i := 0;
- repeat
- begin
- sh := GetString(128 + i);
- if (sh <> nil) then
- aActionMsg[i] := sh^^;
- i := i + 1;
- end;
- until not ((i < ActionMsgNumber) and (sh <> nil));
-
- SATGetPort(tmpPort);
- DrawProgInfo(playerSp);
- SetRect(r, 0, 0, gSAT.offSizeH, gSAT.offSizeV);
- SATBackChanged(r); (*Let SAT show it on screen*)
- SATSetPort(tmpPort);
- end; {InitInformationArea}
-
- procedure DrawProgInfo (me: PlSpritePtr);
- var
- s: Str255;
- r: Rect;
- begin
- SetPort(gSAT.backScreen.port);
- BackColor(blackColor);
-
- SetRect(r, 0, 0, gSAT.bounds.right, 18);
-
- ForeColor(blueColor);
- EraseRect(r);
- PenNormal;
-
- FrameRect(r);
- SetRect(r, 0, 0, gSAT.offSizeH, gSAT.offSizeV);
- FrameRect(r);
-
- ForeColor(redColor);
- MoveTo(10, 13);
- DrawString('This is a Demo for Scrolling and Platform Game.(made by Nissan Zafrir 1995)');
-
- SetRect(r, 1, 350, gSAT.offSizeH - 150, 366);
- EraseRect(r);
- ForeColor(yellowColor);
-
- MoveTo(10, 362);
- DrawString('Speed.V = ');
-
- (*** Displaying SpeedV info ***\}
- {NumToString(me->speed.v, s);}
- {MoveTo(100, 362);}
- {DrawString("\pSpeed.V = ");}
- {MoveTo(170, 362);}
- {DrawString(s);}
- {*******************************)
- MoveTo(110, 362);
- DrawString('Action = ');
-
- MoveTo(700, 362);
- DrawString('H = ');
-
- (*** Displaying PositionV info ***\}
- {MoveTo(350,362);}
- {DrawString("\pV = ");}
- {MoveTo(370,362);}
- {NumToString(me->position.v, s);}
- {DrawString(s);}
- {**********************************)
- ForeColor(blackColor);
- BackColor(whiteColor);
- end; {DrawProgInfo}
-
- procedure UpdateInfo (me: PlSpritePtr);
- var
- s: Str255;
- sh: StringHandle;
- r: Rect;
- begin
- BackColor(blackColor);
- ForeColor(yellowColor);
-
- SetRect(r, 80, 350, 110, 366);
- EraseRect(r);
- NumToString(me^.speed.v, s);
- MoveTo(80, 362);
- DrawString(s);
-
- if (me^.action <> lastActMsg) then
- begin
- SetRect(r, 165, 350, 310, 366);
- EraseRect(r);
- MoveTo(165, 362);
- lastActMsg := me^.action;
- DrawString(aActionMsg[lastActMsg]);
- end;
- SetRect(r, 720, 350, 750, 366);
- EraseRect(r);
- MoveTo(720, 362);
- NumToString(me^.position.h, s);
- DrawString(s);
-
- ForeColor(blackColor);
- BackColor(whiteColor);
- end; {UpdateInfo}
-
- procedure DrawProgrammerInfo;
- var
- s: Str255;
- r: Rect;
- tmpPort: SATPort;
- begin
- SATGetPort(tmpPort);
- SATSetPortScreen;
- UpdateInfo(playerSp);
- SATSetPort(tmpPort);
- end; {DrawProgrammerInfo}
-
- end.